<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>二维码支付 - 寻香茶文化体验</title>
    <style>
        /* 全局样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Arial', '微软雅黑', sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }

        /* 导航栏样式 */
        nav {
            background: #2d4538;
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: fixed;
            width: 100%;
            top: 0;
            left: 0;
            z-index: 100;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }

        .nav-logo {
            color: white;
            font-size: 1.5rem;
            font-weight: bold;
        }

        .nav-links {
            display: flex;
            gap: 2rem;
        }

        .nav-links a {
            color: white;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 4px;
            transition: background 0.3s ease;
        }

        .nav-links a:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        /* 支付容器样式 */
        .payment-container {
            max-width: 800px;
            margin: 100px auto 50px;
            padding: 2rem;
            background: white;
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .payment-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .payment-title {
            color: #2d4538;
            font-size: 1.8rem;
            margin-bottom: 1rem;
        }

        .payment-desc {
            color: #666;
            font-size: 1.1rem;
        }

        .order-info {
            background: #f8f9fa;
            padding: 1.5rem;
            border-radius: 10px;
            margin-bottom: 2rem;
        }

        .info-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 1rem;
            padding: 0.5rem 0;
            border-bottom: 1px solid #eee;
        }

        .info-label {
            color: #666;
            font-weight: bold;
        }

        .info-value {
            color: #2d4538;
            font-weight: bold;
        }

        .qr-box {
            text-align: center;
            padding: 2rem;
            background: #f8f9fa;
            border-radius: 10px;
            margin-bottom: 2rem;
        }

        .qr-img {
            width: 200px;
            height: 200px;
            margin-bottom: 1rem;
            border: 1px solid #ddd;
            padding: 10px;
            background: white;
        }

        .countdown {
            color: #e65100;
            font-size: 1.2rem;
            font-weight: bold;
            margin: 1rem 0;
        }

        .pay-tip {
            color: #666;
            font-size: 1rem;
            margin-top: 1rem;
        }

        .payment-status {
            text-align: center;
            margin-top: 2rem;
            padding: 1rem;
            border-radius: 10px;
            display: none;
        }

        .status-success {
            background: #e8f5e9;
            color: #2e7d32;
        }

        .status-failed {
            background: #ffebee;
            color: #c62828;
        }

        .action-buttons {
            display: flex;
            gap: 1rem;
            margin-top: 2rem;
        }

        .pay-btn {
            flex: 1;
            background: linear-gradient(135deg, #3c9d9b, #2d8a89);
            color: white;
            border: none;
            padding: 12px 0;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: bold;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            transition: all 0.3s;
        }

        .pay-btn:hover {
            background: linear-gradient(135deg, #2d8a89, #1c7978);
            transform: translateY(-2px);
        }

        .back-link {
            flex: 1;
            display: block;
            text-align: center;
            background: #f5f5f5;
            color: #666;
            padding: 12px 0;
            border-radius: 8px;
            text-decoration: none;
            font-size: 1.1rem;
            font-weight: bold;
            transition: all 0.3s;
        }

        .back-link:hover {
            background: #e0e0e0;
            color: #333;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav>
        <div class="nav-logo">寻香茶</div>
        <div class="nav-links">
            <a href="menu.html">首页</a>
            <a href="booking.html">返回</a>
        </div>
    </nav>

    <div class="payment-container">
        <div class="payment-header">
            <h1 class="payment-title">微信支付</h1>
            <p class="payment-desc">请使用微信扫描二维码完成支付</p>
        </div>
        
        <div class="order-info">
            <div class="info-item">
                <span class="info-label">订单金额：</span>
                <span class="info-value" id="pay-amount">￥0.00</span>
            </div>
            <div class="info-item">
                <span class="info-label">订单编号：</span>
                <span class="info-value" id="order-id">-</span>
            </div>
            <div class="info-item">
                <span class="info-label">商品名称：</span>
                <span class="info-value" id="product-name">-</span>
            </div>
        </div>

        <div class="qr-box">
            <img src="images/二维码.jpg" alt="支付二维码" class="qr-img" id="qr-code">
            <div class="countdown" id="countdown">支付倒计时：15:00</div>
            <div class="pay-tip">请使用微信扫描二维码完成支付</div>
        </div>

        <div class="action-buttons">
            <button class="pay-btn" onclick="checkPaymentStatus()">我已支付完成</button>
            <a href="booking.html" class="back-link">取消并返回</a>
        </div>

        <div class="payment-status" id="payment-status">
            <p>支付成功！正在跳转...</p>
        </div>
    </div>

    <script>
        // 获取URL参数
        const urlParams = new URLSearchParams(window.location.search);
        const amount = urlParams.get('amount');
        const orderId = urlParams.get('orderId');
        const productName = urlParams.get('productName');

        // 更新页面信息
        document.getElementById('pay-amount').textContent = `￥${amount}`;
        document.getElementById('order-id').textContent = orderId;
        document.getElementById('product-name').textContent = decodeURIComponent(productName);

        // 倒计时功能
        let timeLeft = 15 * 60; // 15分钟
        const countdownElement = document.getElementById('countdown');

        const timer = setInterval(() => {
            const minutes = Math.floor(timeLeft / 60);
            const seconds = timeLeft % 60;
            countdownElement.textContent = `支付倒计时：${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
            
            if (timeLeft <= 0) {
                clearInterval(timer);
                alert('支付超时，请重新下单！');
                window.location.href = 'booking.html';
            }
            timeLeft--;
        }, 1000);

        // 检查支付状态
        function checkPaymentStatus() {
            const statusElement = document.getElementById('payment-status');
            statusElement.style.display = 'block';
            statusElement.classList.add('status-success');
            
            setTimeout(() => {
                window.location.href = 'booking.html';
            }, 2000);
        }
    </script>
</body>
</html>